/*
 * Copyright (c) 2012-2013 www.iflytek.com. All Rights Reserved.
 * This software for customer relationship management system, developed by Ifly@ZY team.
 * Software code and design for the team, copy rights reserved.
 */

package com.iflytek.testing;

/**
 * <p>
 * .
 * </p>
 *
 * @author poplar.yfyang
 * @version 1.0 2013-02-24 3:58 PM
 * @since JDK 1.5
 */
public class Largest {

    /**
     * 从给定的数组中找出数字最大的值，并返回。
     * @param list 给定的整数数组
     * @return 返回最大的整数
     */
    public static int largest(int[] list) {
        if(list.length == 0){
            return 0;
        }
        int index;
//        int max = Integer.MAX_VALUE;
//        int max = 0;
        int max = Integer.MIN_VALUE;
//        for (index = 0; index < list.length -1; index ++){
        for (index = 0; index < list.length ; index ++){
            if(list[index] > max){
                max = list[index];
            }
        }
        return max;
    }
}
